#ifndef _PMT_Digi_
#define _PMT_Digi_

#include "yaml.h"
#include "TGraph.h"
#include "TH1F.h"
#include "TF1.h"
#include <vector>

#include "PhotonLineShape.hh"
#include "InputFileReader.hh"

class PMT
{
public:
    PMT(Int_t, YAML::Node);
    ~PMT();

    void ClassifyNewPhoton(aSimPhoton&);
    void Processing();
    void LoadQuantumEff(std::string);
    void ClearVPhoton();

    inline const std::pair<Double_t, TGraph*> Result() const 
    {
        return std::pair<Double_t, TGraph*>(m_SumQ, m_PMTLineShape);
    }
    inline Double_t Distance(TVector3 Pos)
    {
        return (Pos - m_Position).Mag();
    }

private:
    std::vector<PhotonLineShape*> m_VPhoton;
    TF1* m_QFunc;
    TF1* m_SmearFunc;
    TGraph* m_PMTLineShape;
    TGraph* m_QuantumEff;
    TVector3 m_Position;
    Double_t m_TauVal;
    Double_t m_StartTime;
    Double_t m_StopTime;
    std::pair<Double_t, Double_t> m_BaseLineVal;
    std::pair<Double_t, Double_t> m_TransitVal;
    Int_t m_iPMT;
    Double_t m_SumQ;

};

#endif